<template>
	<view class="timenav">
		<view class="">
			异步接口
		</view>
		<button @click="calStorageFun(1)" type="primary">单次计时器</button>
		<button @click="calStorageFun(2)" type="primary" plain="true">启动传参计时器</button>
		<button @click="calStorageFun(3)" type="warn">取消计时器</button>
		<button @click="calStorageFun(4)" type="warn" plain="true">取消计时器</button>
		<button @click="calStorageFun(5)" type="primary" plain="true">取消计时器</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			calStorageFun(parm){
				switch(parm){
					case 1:
					
					uni.setStorage({
						 key:'userName',
						 data:'cxz',
						 success() {
						 	console.log('userName储存成功');
						 }
					})
					
					break;
					
					case 2:
					uni.setStorage({
						 key:'accout',
						  
						 success() {
						 	console.log('accout读取成功');
						 },
						 fail() {
						 	console.log('accout读取失败');
						 }
						 
					})
					break;
				}
			}
		}
	}
</script>

<style>
.timenav button{
	margin-bottom: 40rpx;
}
</style>
